package me.tonywang.aop;

import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

/**
 * Created by Administrator on 2017/8/30.
 */
/**     
  * 
  * @Description:     
  * @Author:         WANGHUI
  * @CreateDate:     2018/4/3 20:26
  * @Version:        1.0
 */

public class ItfProxy implements InvocationHandler, Serializable {

    public static void main(String[] args) {
        TestInterface itf = (TestInterface) SimpleProxyFactory.getProxy();
        itf.doSth();
    }

    public  Object getProxy(){
        return  Proxy.newProxyInstance(TestInterface.class.getClassLoader(), new Class[] { TestInterface.class }, new ItfProxy());
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("111111");
        return null;
    }
}
